#include <VisitorChangeSimState.h>
#include <SceneViewer.h>
#include <NodeInformationContainer.h>
#include <SceneViewerFunctions.h>
//#include <ObjectListGenerate.h>
#include <OsgClassDataSource/ObjectOsg.h>
#include <NodeInfoContainer.h>
#include <ClassFactoryObjectOsg.h>
#include <ClassFactoryObjectOsg.h>

VisitorChangeSimState::VisitorChangeSimState()
{
	setTraversalMode(osg::NodeVisitor::TraversalMode::TRAVERSE_ALL_CHILDREN);
    //setTraversalMask(0x1);
    setNodeMaskOverride(0xffffffff);//
    m_enableCallBack = false;
}

VisitorChangeSimState::~VisitorChangeSimState()
{

}

void VisitorChangeSimState::apply( osg::Node& node )
{
    if(m_enableCallBack == true)
    {
        osg::Node::NodeMask oldMask = node.getNodeMask();
        oldMask = oldMask | 0x2;
        node.setNodeMask(oldMask);
    }
    else
    {
        osg::Node::NodeMask oldMask = node.getNodeMask();
        oldMask = oldMask & 0xfffffffd;
        node.setNodeMask(oldMask);
    }
}

void VisitorChangeSimState::setEnableCallBack(bool boolValue)
{
    m_enableCallBack = boolValue;
}
